Skip to content

Conversation

hasinhayder
Copy link
Contributor

Summary

This PR updates the initialization of ref<HTMLInputElement> references by explicitly setting them to null.

Changes

  • Updated ref<HTMLInputElement>() to ref<HTMLInputElement | null>(null), ensuring proper type safety.
  • Prevents potential runtime errors by making sure passwordInput.value and currentPasswordInput.value are never undefined.
  • Aligns with Vue best practices for handling template refs.

Why?

  • Without explicit null, TypeScript infers undefined, leading to potential issues when accessing .value.
  • Ensures better predictability and avoids unnecessary runtime checks.

This change improves overall code reliability and maintainability.

### Summary  
This PR updates the initialization of `ref<HTMLInputElement>` references by explicitly setting them to `null`.  

### Changes  
- Updated `ref<HTMLInputElement>()` to `ref<HTMLInputElement | null>(null)`, ensuring proper type safety.  
- Prevents potential runtime errors by making sure `passwordInput.value` and `currentPasswordInput.value` are never `undefined`.  
- Aligns with Vue best practices for handling template refs.  

### Why?  
- Without explicit `null`, TypeScript infers `undefined`, leading to potential issues when accessing `.value`.  
- Ensures better predictability and avoids unnecessary runtime checks.  

This change improves overall code reliability and maintainability.
Copy link
Contributor

@tnylea tnylea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Thanks.

@taylorotwell taylorotwell merged commit 00d7ca6 into laravel:main Feb 24, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants